﻿@page "/client"
@inject IStringLocalizer<Client> Localizer

<h3>@Localizer["Title"]</h3>

<h4>@Localizer["SubTitle"]</h4>

<DemoBlock Title="@Localizer["BasicUsageTitle"]" Introduction="@Localizer["BasicUsageIntro"]" Name="Normal" Demo="typeof(Demos.Client.ClientNormal)">
    <p>@Localizer["BasicUsageP1"]</p>
    <div class="mb-3">
        <p>@((MarkupString)Localizer["BasicUsageP2"].Value)</p>
        <Pre>public void Configure(IApplicationBuilder app)
{
    // ...
    // 增加下面这一行
    app.UseBootstrapBlazor();
    app.UseEndpoints(endpoints =>
    {
        endpoints.MapDefaultControllerRoute();
        endpoints.MapBlazorHub();
        endpoints.MapFallbackToPage("/_Host");
    });
}</Pre>
    </div>

    <Tips>
        <p>@((MarkupString)Localizer["BasicUsageTips"].Value)</p>
    </Tips>

    <div class="mb-3">
        <p>@((MarkupString)Localizer["BasicUsageP3"].Value)</p>
        <Pre>[Inject]
[NotNull]
private WebClientService? ClientService { get; set; }

private ClientInfo? ClientInfo { get; set; }

protected override async Task OnAfterRenderAsync(bool firstRender)
{
    await base.OnAfterRenderAsync(firstRender);

    if (firstRender)
    {
        ClientInfo = await ClientService.GetClientInfo();
        StateHasChanged();
    }
}
</Pre>
    </div>
</DemoBlock>
